<%--
    Document   : index
    Created on : 12.02.2010, 22:48:51
    Author     : Morfant
--%>

<%@page import="stud.cp.user.valueobjects.Weapon"%>
<%@page import="stud.cp.user.valueobjects.WeaponType"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <%@include file="/header.jsp" %>
    <body>
        <div class="page">
            <%@include file="/cap.jsp" %>
            <div id="main">
                <%WeaponType weaponType = (WeaponType) request.getAttribute(PluginConst.WEAPON_TYPE);%>
                <h2>Список оружия.  Тип - <%=weaponType.getName()%>.</h2>
                <table id="buttontable">
                    <tr>
                        <th>
                            <div id="weaponmenucontainer">
                                <ul id="weaponmenu">
                                    <li><a href="<%= response.encodeURL("weapon-action.do")
                                                            + "?"
                                                            + PluginConst.SUBACTION
                                                            + "="
                                                            + PluginConst.GET_ADD_PAGE
                                                            + "&"
                                                            + PluginConst.WEAPON_TYPE_ID
                                                            + "="
                                                            + weaponType.getWeapon_type_id()%>">Добавить</a></li>
                                </ul>
                            </div>
                        </th>
                    </tr>
                </table>
                <% List<Weapon> list =
                                    (List<Weapon>) request.getAttribute(PluginConst.WEAPONS_LIST);
                            if ((list != null) && (list.size() > 0)) {%>
                <table>
                    <tr>
                        <th>
                        </th>
                        <th>
                            Оружие
                        </th>
                        <th>
                            Описание
                        </th>
                    </tr>
                    <%for (Weapon item : list) {%>
                    <tr>
                        <td>
                            <div id="weaponmenucontainer">
                                <ul id="weaponmenu">
                                    <li><a href="<%= response.encodeURL("weapon-action.do")
                                                            + "?"
                                                            + PluginConst.SUBACTION
                                                            + "="
                                                            + PluginConst.GET_VIEW_PAGE
                                                            + "&"
                                                            + PluginConst.WEAPON_ID
                                                            + "="
                                                            + item.getWeapon_id()%>">Просмотр</a></li>
                                    <br>
                                    <li><a href="<%= response.encodeURL("weapon-action.do")
                                                            + "?"
                                                            + PluginConst.SUBACTION
                                                            + "="
                                                            + PluginConst.GET_DELETE_PAGE
                                                            + "&"
                                                            + PluginConst.WEAPON_ID
                                                            + "="
                                                            + item.getWeapon_id()%>">Удалить</a></li>
                                </ul>
                            </div>
                        </td>
                        <td>
                            <%= item.getName()%>
                        </td>
                        <td>
                            <textarea readonly
                                      rows="3"
                                      cols="40"
                                      name="show"
                                      ><%=item.getDescription()%></textarea>
                        </td>
                    </tr>
                    <% }%>
                </table>
                <% }%>
                <p>
                <div id="weaponmenucontainer">
                    <ul id="weaponmenu">
                        <li><a href="<%= response.encodeURL("weapon-action.do")
                                                + "?"
                                                + PluginConst.SUBACTION
                                                + "="
                                                + PluginConst.GET_WEAPON_TYPE_LIST_PAGE%>">К типам оружия</a></li>
                    </ul>
                </div>
                </p>
            </div>
        </div>
    </body>
</html>
